[Feature] Add tracing::instrument to allow generating flame graphs#2887
Open
[Feature] Add tracing::instrument to allow generating flame graphs#2887
tracing::instrument to allow generating flame graphs#2887Conversation
1 task
f9ee562 to
8de48b0
Compare
8de48b0 to
d0ce260
Compare
ljedrz
reviewed
Sep 24, 2025
ljedrz
reviewed
Sep 24, 2025
d0ce260 to
0d0b94b
Compare
0d0b94b to
a42fe8c
Compare
tracing::instrument to allow generating flamegraphstracing::instrument to allow generating flame graphs
ljedrz
reviewed
Oct 7, 2025
ljedrz
reviewed
Oct 7, 2025
ljedrz
reviewed
Oct 7, 2025
ljedrz
reviewed
Oct 7, 2025
ljedrz
approved these changes
Oct 7, 2025
Collaborator
ljedrz
left a comment
There was a problem hiding this comment.
LGTM in general, left some nits and suggestions
Collaborator
Author
|
@vicsn I added a short motivation to the PR description. |
Collaborator
Thank you, that seems valuable. Would this approach be able to replace ProvableHQ/snarkOS#3930 and create a similar graph? Or will we get a different representation? I'm happy to delay merging snarkOS PR 3930 until we hone in on the specific method we want to support long-term |
Collaborator
Author
|
I think there are ways to generate similar graphs with tracing. However, I should be fine to keep both for now, and we can revise it later. |
This feature adds `tracing::instrument` to various functions in snarkVM.
68bc54d to
0ba29ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Generating flamegraphs using stack-based profilers, such as
perftoolsorcargo flamegraphis great to measure CPU-bound synchronous workloads. For asynchronous or I/O bound-codetracingallows emitting information ("spans") about when a certain async function was started and finished, even if that function started/stopped multiple times, was waiting for a system call, or moved between threads.The tracing spans can then be passed to different backends. I am particular interested in flamegraph/flamechart generation for my use case, but it also works with, for example, real-time profilers, such as
tracy.Proposed Changes
This PR adds
tracing::instrumentto various performance-critical functions when theinstrumentationfeature is enabled.This allows, for example, generating flame graphs as is done in snarkOS PR #3916